<?php


get_header(); ?>
<?php $current_cat_id = get_query_var('cat'); ?>
	<section id="primary" class="site-content">
		<div id="content" role="main">

            <h3 class="titlecategory"><?php echo get_category($current_cat_id)->name; ?></h3>
            <?php
            $totalnewspost2 = category_post_count($current_cat_id);
            $max_num_post2 = get_option('posts_per_page');
            $number_of_page2 = round($totalnewspost2 / $max_num_post2);
            $number_of_last_post2 = $totalnewspost2 % $max_num_post2;
            ?>
            <?php  $additionloop2 = new WP_Query("cat=$current_cat_id & paged=$paged");
            $featureoddeven = 1; $counter2=1;
            while ($additionloop2->have_posts()) : $additionloop2->the_post();
                ?>



            <?php if($counter2==1): ?>
                <div class="fisrtfeaturetext">
                    <div class="featuresimage"><?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>
                        <img src="<?php echo $feat_image ?>" alt="featureimage" width="380" height="380" />


                    </div>
                    <a href="<?php the_permalink(); ?>">
                        <div class="wrapcontent">
                            <div class="shortcontent">
                                <h3 class="tileposts"><?php the_title(); ?></h3>
                                <div class="newstext">
                                    <?php  $arraytext = apply_filters('the_content', substr(get_the_content(), 0, 300) ); echo strip_tags($arraytext); ?>
                                </div>
                            </div>

                        </div>
                    </a>
                    <a href="<?php the_permalink(); ?>">
                        <div class="wrapcontent2">
                            <h3 class="tileposts"><?php the_title(); ?></h3>
                            <div class="longcontent">
                                <?php  $arraytext = apply_filters('the_content', (get_the_content()) ); echo strip_tags($arraytext); ?>
                            </div>
                        </div>
                    </a>
                </div>
                <?php  $counter2++; ?>


            <?php else: ?>
                <?php if($counter2==2) : ?>

                    <div class="wrapallsecond">
                    <div class="slidehover2">
                    <ul class="allcontentfeature">
                <?php endif; ?>
                <?php if($featureoddeven%2==1): ?>
                <li>
            <?php endif; ?>
                <a href="<?php the_permalink(); ?>">
                    <div class="secondfeaturetext">
                        <div class="newsimage"><?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>
                            <img src="<?php echo $feat_image ?>" width="185" height="185" alt="featureimage" />

                        </div>
                        <div class="wrapcontent">
                            <h3 class="tileposts"><?php the_title(); ?></h3>
                            <div class="newstext">
                                <?php  $arraytext = apply_filters('the_content', substr(get_the_content(), 0, 100) ); echo strip_tags($arraytext) ?>
                            </div></div>
                        <div class="wrapcontent2">
                            <h3 class="tileposts"><?php the_title(); ?></h3>
                            <div class="newstext">
                                <?php  $arraytext = apply_filters('the_content', get_the_content() ); echo strip_tags($arraytext) ?>
                            </div></div>
                    </div>
                </a>
                <?php if($featureoddeven % 2 == 0  || $counter2==$last3+1): ?>
                </li>
            <?php endif; ?>

                <?php $featureoddeven++ ; $counter2++; $lastitem3 = $last3+1 ;  ?>
                <?php if(($counter2 == $lastitem3) ): ?>
                    </ul>
                    </div>
                    </div>
                <?php endif; ?>
            <?php endif; ?>

            <?php endwhile;       ?>
<div class="categorypagination">
            <?php gento_pagination($additional_loop2->max_num_pages );  ?>
</div>
		</div><!-- #content -->
	</section><!-- #primary -->

<?php //get_sidebar(); ?>
<?php get_footer(); ?>